-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of union! #42
Conversation
Can you run a before-and-after benchmark on the Brusselator to make sure we don't lose performance on |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
- Coverage 72.30% 72.10% -0.21%
==========================================
Files 8 8
Lines 278 276 -2
==========================================
- Hits 201 199 -2
Misses 77 77 ☔ View full report in Codecov by Sentry. |
Setup code: using BenchmarkTools
using SparseConnectivityTracer
include("brusselator.jl")
function benchmark_brusselator(N::Integer)
dims = (N, N, 2)
A = 1.0
B = 1.0
alpha = 1.0
xyd = fill(1.0, N)
dx = 1.0
p = (A, B, alpha, xyd, dx, N)
u = rand(dims...)
du = similar(u)
f!(du, u) = brusselator_2d_loop(du, u, p, nothing)
return @benchmark jacobian_pattern($f!, $du, $u)
end
## Run Brusselator benchmarks
for N in (6, 24)
@info "Benchmarking Brusselator of size $N"
b = benchmark_brusselator(N)
display(b)
end On [ Info: Benchmarking Brusselator of size 6
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 51.700 μs … 4.742 ms ┊ GC (min … max): 0.00% … 95.55%
Time (median): 55.865 μs ┊ GC (median): 0.00%
Time (mean ± σ): 63.044 μs ± 109.052 μs ┊ GC (mean ± σ): 7.22% ± 4.22%
▁▆██▇▃
▂███████▆▄▄▃▂▃▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
51.7 μs Histogram: frequency by time 97.4 μs <
Memory estimate: 108.00 KiB, allocs estimate: 1252.
[ Info: Benchmarking Brusselator of size 24
BenchmarkTools.Trial: 3286 samples with 1 evaluation.
Range (min … max): 1.086 ms … 10.365 ms ┊ GC (min … max): 0.00% … 66.99%
Time (median): 1.248 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.515 ms ± 712.712 μs ┊ GC (mean ± σ): 7.19% ± 12.84%
▃██▆▅▅▄▃▃▁▁▁ ▁ ▁
██████████████▇▇▇█▇▇▆▇████▆▇▆▆▆▆▆▅▅▅▆▅▅▆▅▃▄▅▆██▇▆▆▅▅▅▅▃▅▅▄▃ █
1.09 ms Histogram: log(frequency) by time 4.21 ms <
Memory estimate: 2.15 MiB, allocs estimate: 23416. On [ Info: Benchmarking Brusselator of size 6
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 54.363 μs … 3.114 ms ┊ GC (min … max): 0.00% … 94.77%
Time (median): 62.468 μs ┊ GC (median): 0.00%
Time (mean ± σ): 67.276 μs ± 82.905 μs ┊ GC (mean ± σ): 5.55% ± 4.46%
▁▁▂▃▃▃▄▄▄▅▆▇█▇▆▆▅▄▃▂▂▁▁ ▁ ▂
▅▄██████████████████████████▇▇▇▇▇███████████▇▇▇▇▇▆▆▆▅▆▆▆▆▅▅ █
54.4 μs Histogram: log(frequency) by time 84.6 μs <
Memory estimate: 108.00 KiB, allocs estimate: 1252.
[ Info: Benchmarking Brusselator of size 24
BenchmarkTools.Trial: 3496 samples with 1 evaluation.
Range (min … max): 1.060 ms … 14.582 ms ┊ GC (min … max): 0.00% … 81.11%
Time (median): 1.203 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.424 ms ± 588.615 μs ┊ GC (mean ± σ): 6.73% ± 12.66%
▅█▇▅▄▃▃▃▃▂▂ ▁ ▁
▆██████████████████▇▇▇▇▆▇▆▆▆▆▇▇▇▆██▇▇▅▅▆█████▆▇▆▄▅▆▇▅▅▁▁▄▄▄ █
1.06 ms Histogram: log(frequency) by time 3.58 ms <
Memory estimate: 2.15 MiB, allocs estimate: 23416. |
No obvious changes |
Wait don't merge yet |
Reopened as #44. |
Modify
promote_order
anddistributive_merge
to usereduce